package tcp_server_demo

import (
	"net"
)

type Client struct {
	*connMsg
}

func (c *Client) Dial(network string, addr string, req []byte) ([]byte, error) {
	conn, err := net.Dial(network, addr)
	if err != nil {
		return nil, err
	}
	err = c.Write(conn, req)
	if err != nil {
		return nil, err
	}
	return c.Read(conn)
}

func NewClient() *Client {
	return &Client{}
}
